/**
 * This file is part of iStudy by the spicy chicken
 * thespicychicken.com
**/

#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIPushButton.h>
#import <UIKit/UIThreePartButton.h>
#import <UIKit/UINavigationBar.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView-Hierarchy.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UITable.h>
#import <UIKit/UITableCell.h>
#import <UIKit/UITableColumn.h>
#import <UIKit/UINavBarButton.h>
#import <UIKit/UIGradientBar.h>
#import <UIKit/UITransitionView.h>
#import "iStudyApp.h"

@implementation iStudyApp

- (void) initApplication
{
	_applicationID = @"com.googlecode.iflashcards";
	
	rect = [UIHardware fullScreenApplicationContentRect];
	rect.origin.x = rect.origin.y = 0.0f;
	
	// Set up window and main View
	_window = [[UIWindow alloc] initWithContentRect: rect];
	_mainView = [[UIView alloc] initWithFrame: rect];
	_transitionView = [[UITransitionView alloc] initWithFrame: rect];
	
	// Set up the Set Browser View
	_setBrowser = [[SetBrowser alloc] initWithApplication:self withAppID:_applicationID withFrame:rect];
	_drillView = [[DrillView alloc] initWithApplication:self withAppID:_applicationID withFrame:rect];
	
	[_window orderFront: self];
	[_window makeKey: self];
	[_window _setHidden: NO];
	[_window setContentView: _mainView];
	
	[_mainView addSubview: _transitionView];
	
	[self makeSetBrowserActive];
	
}

/**
 * Transition to the BrowserView
**/
- (void) makeSetBrowserActive
{
	// transition to browserView
	[_transitionView transition:2 toView:_setBrowser];
	NSLog(@"Transition to SetBrowser View");
}

/**
 * The "Drill" view is the one that displays the question and answer pairs
**/
- (void) makeDrillActive: (NSString*)pathToSet
{
	// transition to drillView
	[_transitionView transition:1 toView:_drillView];
	
	
	// Setup the cards
	[_drillView setupDrill:pathToSet];
	
	NSLog(@"Transition to Drill View");
	
}

- (void) applicationDidFinishLaunching: (id) unused
{
	 // Init App
	[self initApplication];
}

- (BOOL)respondsToSelector:(SEL)selector {
  NSLog(@"respondsToSelector: %s", selector);
  return [super respondsToSelector:selector];
}


@end